import numpy as np

t1 = np.arange(24).reshape(4,6)
print("t1: ", t1)
print("t1:.shape：", t1.shape)  # 查看数组的形状  t1:.shape： (12,)

print("-" * 10)
t1[:,2:4] = 0 # 从第3列到第4列
print("列数赋值=",t1)

print("-" * 10)
t1 = np.arange(24).reshape(4,6)
print(t1 < 10)
print("再次t1=",t1)

print("-" * 10)
t1[t1<10] = 0 # 10以为下item变是0
print(t1)

t1 = np.arange(24).reshape(4,6)
print("-" * 10)
print(np.where(t1<10, 0, 10)) # 把t中小于10的数字替换为0，把大于10的替换为10
print("t1=", t1)

print(t1.clip(2,13)) # 小于2的替换为2，大于13的替换为了13

t1 = t1.astype(float)
t1[3,3] = np.nan
print("t1=", t1)